package org.dromara.wms.domain;

import cn.hutool.core.date.DateTime;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonInclude;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.Setter;
import org.dromara.common.core.validate.AddGroup;
import org.dromara.common.core.validate.EditGroup;

import java.io.Serial;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

@Data
@EqualsAndHashCode(callSuper = false)
@TableName("wms_stock_check_line")
public class WmsStockCheckLine implements Serializable {

  @Serial
  private static final long serialVersionUID=1L;


  @ExcelProperty(value = "盘点单ID")
  private Long id;

  @ExcelProperty(value = "ID")
  @TableId(value = "line_id")
  private Long lineId;

  @ExcelProperty(value = "物品")
  private Long productId;

  @ExcelProperty(value = "单位")
  @NotNull(message = "单位不能为空", groups = { AddGroup.class, EditGroup.class })
  private String measureUnit;

  @ExcelProperty(value = "批次号")
  @NotNull(message = "批次号不能为空", groups = { AddGroup.class, EditGroup.class })
  private String batchCode;

  @ExcelProperty(value = "仓库ID")
  @NotNull(message = "仓库不能为空", groups = { AddGroup.class, EditGroup.class })
  private Long warehouseId;

  @ExcelProperty(value = "仓库名")
  @TableField(exist = false)
  private String warehouseName;

  @ExcelProperty(value = "库位")
  private Long areaId;

  @ExcelProperty(value = "供应商")
  private Long supplierId;

  @ExcelProperty(value = "生产厂商")
  private Long manufacturerId;

  @ExcelProperty(value = "盘点前数量")
  private Double beforeQuantity;

  @ExcelProperty(value = "盘点数量")
  private Double checkQuantity;

  @ExcelProperty(value = "有效期")
  private DateTime expireDate;

  @ExcelProperty(value = "备注")
  private String remark;

  @ExcelProperty(value = "产品名称")
  @TableField(exist = false)
  private String productName;

  /**
   * 请求参数
   */
  @Setter
  @JsonInclude(JsonInclude.Include.NON_EMPTY)
  @TableField(exist = false)
  private Map<String, Object> params = new HashMap<>();

  public Map<String, Object> getParams() {
    if (params == null) {
      params = new HashMap<>();
    }
    return params;
  }

  public void setParams(String str, Object obj) {
    if (this.params == null) {
      this.params = new HashMap<>();
    }
    this.params.put(str, obj);
  }

}
